package cn.ronghuanet.user.rabbitmq.listener;

import cn.ronghuanet.user.dto.RegisterNoticeEmailDTO;
import cn.ronghuanet.user.dto.RegisterNoticeSmsDTO;
import cn.ronghuanet.user.rabbitmq.RegisterNoticeRabbitmqConfig;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 用来监听注册成功通知的消息队列:邮件队列  短信队列
 */
@Component
public class RegisterNoticeRabbitmqListener {

    /**
     * @RabbitListener 监听消息队列
     * 通过queues来指明要监听哪一个消息队列
     */
    @RabbitListener(queues = {RegisterNoticeRabbitmqConfig.QUEUE_INFORM_SMS})
    public void smsQueueListener(RegisterNoticeSmsDTO smsDTO){
        System.out.println(smsDTO);
        // 调用短信发送接口发送短信给用户  @TODO
    }

    @RabbitListener(queues = {RegisterNoticeRabbitmqConfig.QUEUE_INFORM_EMAIL})
    public void emailQueueListener(RegisterNoticeEmailDTO emailDTO){
        System.out.println(emailDTO);
        // 调用邮件发送接口发送邮件给用户  @TODO
    }
}
